package com.wantong.jianpu.activitys;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;

import android.os.Bundle;

import com.lxj.xpopup.XPopup;
import com.wantong.jianpu.BR;
import com.wantong.jianpu.R;
import com.wantong.jianpu.base.BaseXActivity;
import com.wantong.jianpu.beans.InspectionDetailBean;
import com.wantong.jianpu.databinding.ActivityTourChildDetailBinding;
import com.wantong.jianpu.dialogs.ReBackPopupView;
import com.wantong.jianpu.dialogs.TourSignPopupView;
import com.wantong.jianpu.event.TourDetailEvent;
import com.wantong.jianpu.viewmodels.TourChildDetailViewModel;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

/**
 * 单次巡查详情
 */
public class TourChildDetailActivity extends BaseXActivity<ActivityTourChildDetailBinding, TourChildDetailViewModel> {

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_tour_child_detail;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        super.initData();
        setToolbar(binding.baseToolBar);
        EventBus.getDefault().register(this);
        viewModel.data.setValue((InspectionDetailBean.RecordListDTO) getIntent().getExtras().getSerializable("data"));
        viewModel.id=viewModel.data.getValue().getId();
    }

    /**
     * 刷新
     * @param event
     */
    @Subscribe
    public void onEvent(TourDetailEvent event){
        finish();
    }


    @Override
    protected void onDestroy() {
        super.onDestroy();
        if(EventBus.getDefault().isRegistered(this)){
            EventBus.getDefault().unregister(this);
        }
    }
}